//
//  SceneTableViewCell.m
//  仿微信朋友圈
//
//  Created by dllo on 16/9/3.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "SceneTableViewCell.h"
#import "HeaderView.h"
#import "LabelView.h"
#import "ImagesView.h"
#import "FromWhereView.h"
#import "CommentView.h"
#import "SDAutoLayout.h"
// model

#import "SceneObj.h"
#import "SceneCommentlist.h"
#import "SCeneCommentcountlist.h"
#import "SceneUserlist.h"
#import "SceneStorylist.h"
#import "ScenePraiseinfolist.h"
#import "ScenePraisecontainerlist.h"

@implementation SceneTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self createView];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor colorWithWhite:0.949 alpha:1.000];


    }
    return self;
}

- (void)createView {
    UIView *backView = [[UIView alloc] init];
    self.headView = [HeaderView new];
    self.imageViews = [ImagesView new];
    self.labelView = [LabelView new];
    self.fromWhereView = [FromWhereView new];
    self.commentView = [CommentView new];
    [self.contentView addSubview:backView];
//    self.headView.backgroundColor = [UIColor redColor];
//    self.imageViews.backgroundColor = [UIColor greenColor];
//    self.labelView.backgroundColor = [UIColor blueColor];
//    self.fromWhereView.backgroundColor = [UIColor yellowColor];
//    self.commentView.backgroundColor = [UIColor purpleColor];
    backView.backgroundColor = [UIColor whiteColor];
    [backView addSubview:_headView];
    [backView addSubview:_imageViews];
    [backView addSubview:_labelView];
    [backView addSubview:_fromWhereView];
    [backView addSubview:_commentView];
    /***************** backView ******************/
    backView.sd_layout
    .leftSpaceToView(self.contentView, 5)
    .rightSpaceToView(self.contentView, 5)
    .topSpaceToView(self.contentView, 5);
    /***************** headView ******************/
    self.headView.sd_layout
    .leftEqualToView(backView)
    .rightEqualToView(backView)
    .topEqualToView(backView)
    .heightIs(40);
    /***************** imageView ******************/
    self.imageViews.sd_layout
    .topSpaceToView(self.headView, 0)
    .leftEqualToView(backView)
    .rightEqualToView(backView)
    .heightIs(100);
    /***************** labelView ******************/
    self.labelView.sd_layout
    .leftEqualToView(backView)
    .rightEqualToView(backView)
    .topSpaceToView(self.imageViews, 0)
    .heightIs(40);
//    [self.labelView setupAutoHeightWithBottomView:_imageViews bottomMargin:10];
    /***************** fromWhere ******************/
    self.fromWhereView.sd_layout
    .leftEqualToView(backView)
    .rightEqualToView(backView)
    .topSpaceToView(self.labelView, 0)
    .heightIs(40);
    /***************** comment ******************/
    self.commentView.sd_layout
    .leftEqualToView(backView)
    .rightEqualToView(backView)
    .topSpaceToView(self.fromWhereView, 0)
    .heightIs(40);
    [backView setupAutoHeightWithBottomView:self.commentView bottomMargin:10];
    [self setupAutoHeightWithBottomView:backView bottomMargin:10];
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
